import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
import {Backend} from '../../providers/backend';
import {TabsPage} from '../tabs/tabs';
import {ImagePipe} from '../../pipes/pipes';
@Component({
  templateUrl: 'build/pages/guide/guide.html',
  pipes: [ImagePipe],
})
export class GuidePage {
  static get parameters() {
    return [[NavController],[Backend]];
  }

  constructor(nav,backend) {
    this.nav = nav;
this.backend=backend;
    this.leftSeconds = 3;
    // this.guideImages = [
    //   { url: 'asset/img/ad-01.png' }
    // ];
this.guideImages;
    this.autoJump = setInterval(() => {
      // this.startApp();
      this.leftSeconds--;
      if (this.leftSeconds == 0) {
        this.startApp();
      }
    }, 1000);
    this.backend.dsQuery({
      entity: 'gtig$SetVersion',
      viewName: '_local',
      query: `select e from gtig$SetVersion e `,
      first: 0,
      max: 1
    }).then((result1) => {
      this.guideImages=result1[0].images.substring(0,result1[0].images.length-1).split(','); 
   
   console.log(result1,88888,this.guideImages);
      // loading.dismiss();
    });
  }

  startApp() {
    clearInterval(this.autoJump);
    this.nav.setRoot(TabsPage);
  }

  // onSlideChangeStart(slider) {
  //   this.isEnd = slider.isEnd;

  //   clearTimeout(this.autoJump);

  //   setTimeout(() => {
  //     this.guideActive = slider.activeIndex;
  //   }, 100);

  // }

}
